home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet multimedia / Linux LiveCD / GeeXboX 1.0 EN / geexbox-1.0-en.i386.iso / GEEXBOX / etc / init.d / 75_mp-tvcard < prev    next >
Text File  |  2006-06-21  |  3KB  |  77 lines

  1. #!/bin/sh
  2. #
  3. # configure MPlayer's v4l2 settings
  4. #
  5. # runlevels: geexbox, debug
  6.  
  7. echo "### Configuring MPlayer's v4l2 support ###"
  8.  
  9. if [ -f /var/tvcard -a -c /dev/video0 ]; then
  10.   . /etc/tvcard
  11.   . /var/tvcard
  12.  
  13.   # configure mplayer v4l2 driver
  14.   if [ -n "$TV_WIDTH" -a -n "$TV_HEIGHT" ]; then
  15.     TV_OPTIONS=":width=$TV_WIDTH:height=$TV_HEIGHT"
  16.   fi
  17.   if [ -n "$TV_BRIGHTNESS" ]; then
  18.     TV_OPTIONS="$TV_OPTIONS:brightness=$TV_BRIGHTNESS"
  19.   fi
  20.   if [ -n "$TV_CONTRAST" ]; then
  21.     TV_OPTIONS="$TV_OPTIONS:contrast=$TV_CONTRAST"
  22.   fi
  23.   if [ -n "$TV_HUE" ]; then
  24.     TV_OPTIONS="$TV_OPTIONS:hue=$TV_HUE"
  25.   fi
  26.   if [ -n "$TV_SATURATION" ]; then
  27.     TV_OPTIONS="$TV_OPTIONS:saturation=$TV_SATURATION"
  28.   fi
  29.  
  30.   if [ `grep -c ^CHAN /etc/tvcard` -gt 0 ]; then
  31.     for CHAN in `sed -n 's/^CHAN="\(.*\):\(.*\)"/\1-\2/p' /etc/tvcard | sed 'y/ /_/' `; do
  32.       mp_set_option tv=channels "$CHAN" concat
  33.     done
  34.   else
  35.     sed "s/.*set_menu tv_chan.*//" /etc/mplayer/menu.conf
  36.   fi
  37.  
  38.   echo "tv=driver=v4l2:norm=$TVIN_STANDARD:chanlist=$CHANLIST$TV_OPTIONS" >> /etc/mplayer/mplayer.conf
  39.  
  40.   if [ -x /usr/bin/mencoder ]; then
  41.     AUDIO_OPTIONS=`cat /var/recorder_alsa`
  42.     sed -i "s/^#tv=tv_options.*/tv=driver=v4l2:norm=$TVIN_STANDARD:chanlist=$CHANLIST$TV_OPTIONS$AUDIO_OPTIONS/" /etc/mplayer/mencoder.conf
  43.     TV_CHANNELS=`grep -e tv=channels /etc/mplayer/mplayer.conf`
  44.     sed -i "s/^#tv=tv_channels.*/$TV_CHANNELS/" /etc/mplayer/mencoder.conf
  45.   fi
  46.  
  47.   IFS='
  48. '
  49.   # set mplayer TV channels list
  50.   echo "<cmdlist name=\"tv_chan\" title=\"TV Channels\" ptr=\"\" item-bg=\"-1\" title-bg=\"-1\" ptr-bg=\"164\" auto-close=\"yes\" >" >> /etc/mplayer/menu.conf
  51.   for CHNAME in `sed -n 's/^tv=channels=//p' /etc/mplayer/mplayer.conf | sed -e 's/,/\n/g' -e 's/_/ /g' | sed 's/\(.*\)-\(.*\)/\2/'`; do
  52.     echo "<e name=\"$CHNAME\" ok=\"loadfile tv://$((++n))\"/>" >> /etc/mplayer/menu.conf
  53.   done
  54.   echo "</cmdlist>" >> /etc/mplayer/menu.conf
  55. else
  56.   # remove tv options from menu
  57.   sed -i 's/.*ok="set_menu tv_settings".*//' /etc/mplayer/menu.conf
  58.   sed -i 's/.*ok="set_menu tv_norm".*//' /etc/mplayer/menu.conf
  59. fi
  60.  
  61.  
  62. [ -f /var/digimatrix ] && sed -i 's/set_menu radio_settings/set_menu digimatrix_radio/' /etc/mplayer/menu.conf
  63.  
  64. [ -f /etc/radio ] && . /etc/radio
  65.  
  66. if [ "$RADIO" = yes ]; then
  67.   # set mplayer menu radio stations list
  68.   echo "<cmdlist name=\"radio_chan\" title=\"Radio Stations\" ptr=\"\" item-bg=\"-1\" title-bg=\"-1\" ptr-bg=\"164\" >" >> /etc/mplayer/menu.conf
  69.   grep '^CHAN' /etc/radio | sed "s/^CHAN=\"\([^:]*\):\(.*\)\"/<e name=\"\2\" ok=\"run 'fmio -d v4l -v 50 -f \1'\"\/>/" >> /etc/mplayer/menu.conf
  70.   echo "</cmdlist>" >> /etc/mplayer/menu.conf
  71. else
  72.   # no supported radio card specified
  73.   sed -i 's/.*ok="set_menu radio_settings".*//' /etc/mplayer/menu.conf
  74. fi
  75.  
  76. exit 0
  77.